home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / util / moni / restracker.lha / restracker / rtPublic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-11  |  1.6 KB  |  60 lines

  1. /* Two handy macros for handling ResourceLists and MinLists
  2. ** (slightly changed list macros from exec/lists.h)
  3. */
  4. #define IsResrcListEmpty(x) \
  5.     ( ((x)->mlh.mlh_TailPred) == (struct MinNode *)(x) )
  6. #define IsMinListEmpty(x) \
  7.     ( ((x)->mlh_TailPred) == (struct MinNode *)(x) )
  8.  
  9. /* a macro to quickly get the number of allocations from a resource list */
  10. #define CURRENTALLOCS(list) (list->totalloc - list->totfree)
  11.  
  12. /* makes a stringpointer to resource description from pointer to resource node */
  13. #define RESOURCE_IDSTRING(rn) (*((STRPTR*)((UBYTE*)(rn->resource)+rl->idoffset)))
  14.  
  15. /* name of the public semaphore created by rt */
  16. #define RT_SEMAPHORENAME "ResourceTracker"
  17.  
  18. /* Version and revision numbers to check
  19. ** These are not identical with the program versions! They are only changed
  20. ** when the format of rt's data structures changes.
  21. */
  22. #define RT_STRUCTVERSION 39
  23. #define RT_STRUCTREVISION 5
  24. #define RT_VERSION ((RT_STRUCTVERSION<<8) | RT_STRUCTREVISION)
  25.  
  26. /* the node structure for a single resource */
  27. struct rt_ResNode
  28. {
  29.     struct MinNode node;
  30.     APTR resource;
  31.     struct Task *task;
  32. };
  33.  
  34. /* the main list, to be found directly following the public sempahore */
  35. struct rt_MainList
  36. {
  37.     struct MinList mlh;
  38.     UWORD version;
  39. };
  40.  
  41. /* the list structure for a single resource type. allocated once for every
  42. ** alloc()/free() pair
  43. */
  44. struct rt_ResList
  45. {
  46.     struct MinList mlh;
  47.     WORD allocoffset;
  48.     WORD freeoffset;
  49.     STRPTR libname;
  50.     APTR pool;
  51.     WORD idoffset;
  52.     BYTE freereg;
  53.     BYTE pad;
  54.     ULONG totalloc;
  55.     ULONG totfree;
  56. };
  57.  
  58. /* the prototype for the FreeResource() asm function */
  59. extern __far __asm FreeResource(register __a3 APTR resource, register __a4 struct rt_ResList*);
  60.